/*     */ package com.lmpop.trade.ti_vote;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_voteInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_voteInfo()
/*     */   {
/*  16 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  25 */     Ti_vote ti_vote = new Ti_vote();
/*  26 */     ti_vote.setVote_id(map.getString("vote_id"));
/*  27 */     ti_vote.setCust_id(map.getString("cust_id"));
/*  28 */     ti_vote.setVote_title(map.getString("vote_title"));
/*  29 */     ti_vote.setStart_date(map.getString("start_date"));
/*  30 */     ti_vote.setEnd_date(map.getString("end_date"));
/*  31 */     ti_vote.setIs_multi(map.getInt("is_multi"));
/*  32 */     ti_vote.setVote_count(map.getInt("vote_count"));
/*  33 */     ti_vote.setUser_id(map.getString("user_id"));
/*  34 */     ti_vote.setIn_date(map.getString("in_date"));
/*     */ 
/*  36 */     String result_code = "0";
/*     */     try {
/*  38 */       insert(dbmMgr, ti_vote);
/*     */     } catch (ApplicationException e) {
/*  40 */       e.printStackTrace();
/*  41 */       result_code = "1";
/*     */     }
/*  43 */     map.setString("result_code", result_code);
/*  44 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_vote ti_vote)
/*     */     throws ApplicationException
/*     */   {
/*  53 */     dbmMgr.update("insertTi_vote", ti_vote);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  63 */     String pkid_string = map.getString("pkid");
/*  64 */     String result_code = "0";
/*     */     try {
/*  66 */       if (!pkid_string.equals("")) {
/*  67 */         String[] pkStr = pkid_string.split("\\|");
/*  68 */         for (int i = 0; i < pkStr.length; i++) {
/*  69 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  73 */       e.printStackTrace();
/*  74 */       result_code = "1";
/*     */     }
/*  76 */     map.setString("result_code", result_code);
/*  77 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  86 */     dbmMgr.update("deleteTi_vote", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  95 */     Ti_vote ti_vote = new Ti_vote();
/*  96 */     ti_vote.setVote_id(map.getString("vote_id"));
/*  97 */     ti_vote.setCust_id(map.getString("cust_id"));
/*  98 */     ti_vote.setVote_title(map.getString("vote_title"));
/*  99 */     ti_vote.setStart_date(map.getString("start_date"));
/* 100 */     ti_vote.setEnd_date(map.getString("end_date"));
/* 101 */     ti_vote.setIs_multi(map.getInt("is_multi"));
/* 102 */     ti_vote.setVote_count(map.getInt("vote_count"));
/* 103 */     ti_vote.setUser_id(map.getString("user_id"));
/* 104 */     ti_vote.setIn_date(map.getString("in_date"));
/*     */ 
/* 106 */     String result_code = "0";
/*     */     try {
/* 108 */       update(dbmMgr, ti_vote);
/*     */     } catch (ApplicationException e) {
/* 110 */       e.printStackTrace();
/* 111 */       result_code = "1";
/*     */     }
/* 113 */     map.setString("result_code", result_code);
/* 114 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_vote ti_vote)
/*     */     throws ApplicationException
/*     */   {
/* 123 */     dbmMgr.update("updateTi_vote", ti_vote);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 133 */     Map ti_vote = (Hashtable)obj;
/* 134 */     if (start == 0)
/* 135 */       start = 0;
/*     */     else {
/* 137 */       start = (start - 1) * limit;
/*     */     }
/* 139 */     ti_vote.put("start", Integer.valueOf(start));
/* 140 */     ti_vote.put("limit", Integer.valueOf(limit));
/* 141 */     return this.queryList.getList("getListByTi_votePage", ti_vote);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 152 */     Map ti_vote = (Hashtable)obj;
/* 153 */     List list = this.queryList.getList("getCountByObjTi_vote", ti_vote);
/* 154 */     int count = 0;
/* 155 */     if ((list != null) && (list.size() > 0)) {
/* 156 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 157 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 158 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 161 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 171 */     return this.queryList.getList("getTi_voteByPk", pk);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_vote.Ti_voteInfo
 * JD-Core Version:    0.6.0
 */